﻿using Gx.Bll.Manage;
using Gx.ColdWarehouseErp.Controllers;
using Gx.Model.Entity;
using Gx.Model.ViewModel;
using System.Linq;
using System.Web.Mvc;
namespace Gx.ZhiChengXianWei.Controllers
{
    public class LKBillTemplateController : BaseController
    {
        protected LKBillTemplateBll lKBillTemplateBll = new LKBillTemplateBll();
        //
        // GET: /LKBillTemplate/

        public ActionResult List()
        {
            return View();
        }
        
        ///// <summary>
        ///// 分页列表
        ///// </summary>
        ///// <param name="customerInput"></param>
        ///// <returns></returns>
        //public JsonResult GetLKBillTemplatePageList(LKBillTemplateInput input)
        //{
        //    var result = lKBillTemplateBll.GetLKBillTemplatePageList(input);
        //    return JsonList(result.Total, result.List.ToArray());
        //}


        /// <summary>
        /// 获取单据模板
        /// </summary>
        /// <returns></returns>
        public JsonResult GetLKBillTemplate()
        {
            var result = lKBillTemplateBll.GetLKBillTemplates();
            return Json(result, JsonRequestBehavior.AllowGet);
        }

        /// <summary>
        /// 新增单据模板
        /// </summary>
        /// <param name="lKBillTemplate"></param>
        /// <returns></returns>
        public JsonResult AddLKBillTemplate(LKBillTemplate lKBillTemplate)
        {
            var result = lKBillTemplateBll.AddLKBillTemplate(lKBillTemplate);
            //string message = result ? "新增成功" : "新增失败";
            return Json(result.Success, result.Msg);
        }

        /// <summary>
        /// 编辑单据模板
        /// </summary>
        /// <param name="lKBillTemplate"></param>
        /// <returns></returns>
        public JsonResult EditLKBillTemplate(LKBillTemplate lKBillTemplate)
        {
            var result = lKBillTemplateBll.EditLKBillTemplate(lKBillTemplate);
            string message = result ? "编辑成功" : "编辑失败";
            return Json(result, message);
        }

        /// <summary>
        /// 删除单据模板
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult DeleteLKBillTemplate(int id)
        {
            var result = lKBillTemplateBll.DeleteLKBillTemplate(id);
            string message = result ? "删除成功" : "删除失败";
            return Json(result, message);
        }
    }
}

